<?php
declare(strict_types=1);

namespace app\api\model\activity;

use app\api\model\UploadFile;
use app\common\model\activity\Goods as BaseGoods;
use think\model\relation\HasOne;

class Goods extends BaseGoods
{
    /**
     * @return HasOne
     */
    public function image(): HasOne
    {
        return $this->hasOne(UploadFile::class,'file_id','image_id')->bind(['image_url' => 'preview_url']);
    }


    public function goods(): HasOne
    {
        return $this->hasOne(\app\api\model\Goods::class,'goods_id','goods_source_id');
    }
}